package homework.ooday01;

import java.util.Objects;

public class Student {
    String name;
    int age;
    String className;
    String stuId;

    public Student(){

    }
    public Student(String name,int age){
        this.name = name;
        this.age = age;
    }

    public Student(String name,int age,String className,String stuId){
        this.name = name;
        this.age = age;
        this.className = className;
        this.stuId = stuId;
    }
    public void study(){
        System.out.println(name+"在学习");
    }
    public void sayHi(){
        System.out.println(name+"今年"+age+"岁，人在"+className+"班级，学号是："+stuId);
    }
    public void playWith(String anotherName){
        System.out.println(name+"和"+anotherName+"在玩。。。");
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age && Objects.equals(name, student.name) && Objects.equals(className, student.className) && Objects.equals(stuId, student.stuId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, className, stuId);
    }
}
